<?php

// 本类由系统自动生成，仅供测试用途
class BookinfoAction extends Action {

    public function index() {
        $order = M('goodsorder');
        $condition['userid'] = $_SESSION['uid'];
        $orderlist = $order->where($condition)->order('ordertime desc')->select();
        //var_dump($orderlist);
        foreach ($orderlist as $val){
            $goodsArray = json_decode($val['orderdetail'],TRUE); 
            foreach ($goodsArray['order'] as $key =>$goodsval){
                if($goodsval['goodsnum']=='0'){
                    unset($goodsArray['order'][$key]);
                }
            }
            $orderArray = $goodsArray;
            $orderArray['orderid'] = $val['id'];
            $orderArray['userid'] = $val['userid'];
            $orderArray['datetime'] = $val['ordertime'];
            $myorderlistArray[] = $orderArray;           
        }
        $this->assign('myorderlistArray', $myorderlistArray);
        $this->display();
    }

}